package com.hxx.controller;

import com.hxx.ai.NumberExtractor;
import com.hxx.ai.PersonExtractor;
import com.hxx.ai.SentimentAnalyzer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ExecController {
    @Autowired
    private NumberExtractor numberExtractor;
    @Autowired
    private SentimentAnalyzer sentimentAnalyzer;

    @Autowired
    private PersonExtractor personExtractor;

    //数字：我今天要请五天假
    @GetMapping("/num")
    public int num(String prompt){
        int i = numberExtractor.extractInt(prompt);
        return i;
    }

    //情感测试：假期结束开始上班
    @GetMapping("/positive")
    public String isPositive(String prompt){
        return sentimentAnalyzer.isPositive(prompt)+"";
    }

    //情感测试：假期结束开始上班
    @GetMapping("/anal")
    public String anal(String prompt){
        return sentimentAnalyzer.analyzeSentimenetOf(prompt).toString();
    }
    //人员信息：帮我创建一个用户，名字叫张三，生日是1990-01-01
    @GetMapping("/person")
    public String personExec(String prompt){
        return personExtractor.extractPerson(prompt).toString();
    }
}